#include <bits/stdc++.h>

using namespace std;
const int N = 1001, M = 10001;

struct Edge {
    int x, y, z;

    bool operator<(const Edge other) const {
        return z < other.z;
    }
};

Edge edges[M];
int F[N];

int find(int x) {
    return F[x] == x ? x : F[x] = find(F[x]);
}

bool merge(int x, int y) {
    int rx = find(x);
    int ry = find(y);
    if (rx == ry)return false;
    F[rx] = ry;
    return true;
}

int main() {
    int n, m, k;
    while (cin >> n >> m >> k) {
        for (int i = 1; i <= n; i++) {
            F[i] = i;//并查集初始化
        }
        for (int i = 1; i <= m; i++) {
            cin >> edges[i].x >> edges[i].y >> edges[i].z;//存边
        }
        sort(edges + 1, edges + m + 1);
        int cnt = 0;
        int sum = 0;
        for (int i = 1; i <= m; i++) {
            if (merge(edges[i].x, edges[i].y)) {
                cnt++;
                sum += edges[i].z;
                if (cnt >= n - k)break;
            }
        }
        if (cnt >= n - k) //是否能取到n - K条边,一个棉花糖需要n-1条边，2个棉花糖需要n-2条边
        {
            cout << sum << endl;
        } else {
            cout << "No Answer" << endl;
        }
    }
}